<template>
	<view class="battery-area">
		<view class="row" v-for="i in count" :key="i"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				count: 5,
			}
		},
		onLoad() {
			this.refreshTime = setInterval(() => {
				let numNew = this.count + 1
				this.count = numNew % 6;
				if (!this.count) {
					this.count = 1;
				}
			}, 1000);
		},
		onUnload() {
			clearInterval(this.refreshTime);
		}
	}
</script>

<style lang="scss">
	.battery-area {
		position: relative;
		margin-left: 300rpx;
		margin-top: 100rpx;
		width: 50rpx;
		height: 60rpx;
		border-radius: 5rpx;
		border: 3rpx solid #36cc34;
		padding: 5rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		justify-content: flex-end;

		.row {
			width: 100%;
			height: 8rpx;
			background: #36cc34;
			margin-top: 3rpx;
		}
	}
</style>
